package zuoye.zuoye2;

import java.util.ArrayList;
import java.util.Collection;

public class Test {
    public static void main(String[] args) {
        ArrayList<Pepole> ren = new ArrayList<>();
        ren.add(new Pepole("张三",22));
        ren.add(new Pepole("王五",23));
        ren.add(new Pepole("赵六",24));
        ren.add(new Pepole("张翠山",38));
        ren.add(new Pepole("张三丰",103));
        ren.add(new Pepole("张无忌",17));
        getPepole( ren);
    }
    public static void getPepole(Collection<Pepole> ren){
        for (Pepole pepole : ren) {
            if (pepole.getAge() > 18 && pepole.getName().startsWith("张")){
                System.out.println(pepole);
            }
        }

    }

    }

